<?php
require_once('./admin/connexion.php');
require ('./func.req.php');
if ($install) {
    header("Location:./install/index.php");
} else {
    require('./config/tbl.php');
    if ($line_info['maintenance_choix_info'] == "Oui") {
        show_maintenance();
    } else {

        /*
          -----------------------------------
          ---- SCRIPT D'AUTHENTIFICATION ----
          FujiCraft V3.0
          By Fujido
          Contact : thefujido@gmail.com
          -----------------------------------
         */

        session_start(); // On relaye la session
        if (@session_is_registered("authentification")) { // v�rification sur la session authentification (la session est elle enregistr�e ?)
// ici les �ventuelles actions en cas de r�ussite de la connexion
        }
// GESTION DE LA D�connexion
        if (isset($_GET['erreur']) && $_GET['erreur'] == 'logout') { // Test sur les param�tres d'URL qui permettront d'identifier un "contexte" de d�connexion
            $prenom = $_SESSION['prenom']; // On garde le pr�nom en variable pour dire au revoir (soyons polis :-)
            @session_unset("authentification");
            header("Location:login.php?erreur=logout");
        }
        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <title><?php echo $site; ?> | Foire Aux Questions</title>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <meta http-equiv="Content-Style-Type" content="text/css" />
                <meta http-equiv="content-language" content="fr,en" />
                <link rel='shortcut icon' type="image/x-icon" href='./images/favicon.ico' />
                <link rel="stylesheet" type="text/css" href="./css/style.css" title="" media="all" />
                <link rel="stylesheet" type="text/css" href="./css/news.css" title="" media="all" />
                <script type="text/javascript" src="./js/news.js"></script>
            </head>
            <body>
                <div id="block">
                    <div id="contentblock">
                        <div class="wrapper">
                            <?php
                            show_header();
                            show_menu();
                            show_newsbox();
                            show_userbox();
                            //Selection de la table
                            $query_faq = "SELECT * FROM " . $database . "." . $tb_faq . " ";
                            //Affichage de la selection
                            $result_faq = @mysql_query($query_faq) OR DIE("Erreur de la s&eacute;lection de la Foire Aux Questions : " . mysql_error());
                            //Affichage de la selection (pour les reponses)
                            $result_faq_rep = @mysql_query($query_faq) OR DIE("Erreur de la s&eacute;lection de la Foire Aux Questions : " . mysql_error());
                            ?>
                            <div class="mainbox">
                                <h2>Foire Aux Questions</h2>
                                <?php
                                if (mysql_num_rows($result_faq) == 0) {
                                    ?>
                                    <div id="box" onclick="document.getElementById('box').style.display='none';" class="info-box rounded" style="margin:5%;" title="Fermer la fen&ecirc;tre">
                                        Aucune question-r&eacute;ponse n'existe.
                                    </div>
                                    <?php
                                } else {
                                    ?>
                                    <div class="centre">
                                        <div id="faq">
                                            <h3>F.A.Q.</h3>
                                            <ul>
                                                <?php
                                                while ($faq = mysql_fetch_assoc($result_faq)) {
                                                    ?>
                                                    <li><a href="#<?php echo $faq['id_faq']; ?>">- <?php echo addChar($faq['question_faq']); ?></a></li>
                                                    <?php
                                                }
                                                ?>
                                            </ul>
                                            <br />
                                            <h3>R&eacute;ponse</h3>
                                            <?php
                                            while ($faq_rep = mysql_fetch_assoc($result_faq_rep)) {
                                                ?>
                                                <p id="<?php echo $faq_rep['id_faq']; ?>"><strong><?php echo addChar($faq_rep['question_faq']); ?></strong><br />
                                                    <?php echo addChar($faq_rep['reponse_faq']); ?></p><br />
                                                <?php
                                            }
                                            ?>
                                            <br />
                                        </div>
                                        <br />
                                    </div>
                                    <?php
                                }
                                ?>
                            </div>
                            <?php show_footer(); ?>
                        </div>
                    </div>
                </div> 
                </div>
            </body>
        </html>
        <?php
    }
}
?>